package WaiBao;

import java.util.Arrays;

public class WeiLongYang {
    public static void main(String[] args) {
        String[] name = {"东方耀(班长)", "东方镜(副班长)", "小李(学习委员)", "典韦(文艺委员)", "廉颇", "夏洛特", "韩星", "韩信", "韩红", "码云", "马云", "马化腾",
                "张一鸣", "张作霖", "王境泽", "忘忧岛", "迷宫", "张缓缓", "李子维", "郭鹏", "李兆华", "刘长山", "钟珊珊", "张子云", "黄兴", "马中正", "李金城", "张昊天",
                "吴奇隆", "卫飞洋(学生)"};//考生本人:卫飞洋(学生)
        int[] age = {21, 19, 19, 21, 22, 22, 21, 22, 19, 20, 19, 19, 20, 19, 21, 20, 20, 19, 20, 19, 19, 21, 21, 21, 20, 21, 19, 19, 20, 19};//考生年龄：19岁

        double[] miaomiao1 = {78, 86, 84, 79, 78, 74, 75, 65, 73, 81, 68, 77, 71, 78, 79, 70, 82, 84, 86, 58, 92, 87, 90, 85, 75, 71, 74, 72, 85, 95};
        double[] miaomiao2 = {88, 74, 78, 71, 82, 77, 73, 84, 78, 78, 85, 85, 85, 74, 87, 74, 74, 79, 64, 85, 97, 71, 86, 81, 88, 85, 81, 86, 87, 96};
        double[] miaomiao3 = {74, 84, 94, 83, 71, 61, 78, 80, 84, 60, 63, 81, 75, 75, 95, 64, 69, 69, 96, 93, 92, 81, 75, 75, 79, 84, 77, 61, 91, 96};

        double cixi1;//代表每个学生的总分
        double cixi2;//代表每个学生的平均分
//        for (int i = 0; i < 30; i++) {
//            cixi1 = miaomiao1[i] +miaomiao2[i] +miaomiao3[i];
//            cixi2 = ( cixi1 * 1.0) / 3;
//            System.out.println(name[i] + "的总分为:" +cixi1);
//            System.out.println(name[i] + "的平均分为:" +cixi2);
//        }

        double leshi1 = 0,leshi2 = 0;
        double[] heihei = new double[30];
//        for (int i = 0; i < 30; i++) {
//            leshi1 = miaomiao1[i] +miaomiao2[i] + miaomiao3[i];
//            leshi2= (leshi1 * 1.0) / 3;
//            heihei[i] = leshi2;
//        }
//
//        for (int i = 0; i <heihei.length - 1; i++) {
//            for (int j = 0; j < heihei.length - i - 1; j++) {
//                if (heihei[j] < heihei [j + 1]) {
//                    double tep =heihei[j];
//                    heihei[j] =heihei[j + 1];
//                    heihei[j + 1] = tep;
//                }
//            }
//        }
//        System.out.println("前十名同学的成绩为:");
//        for (int i = 0; i < 10; i++) {
//            System.out.println(heihei[i]);
//        }



        double head1 = 0, head2 = 0, head3 = 0;//计算每门课的平均分
        double meiyou1 = 0,meiyou2 = 0, meiyou3 = 0;//计算每门课标准差
        double langya1 = 0,langya2 = 0,langya3 = 0;//计算每门课中位数
        double sum2 = 0;
        for (int i = 0; i <miaomiao1.length; i++) {
            sum2+=miaomiao1[i];
        }
        head1 = (sum2*1.0)/30;
        System.out.println("生物化学的班级平均分为:"+ head1);
        double Sum = 0;
        for (int i = 0; i <miaomiao2.length; i++) {
            Sum+=miaomiao2[i];
        }
        head2 = (Sum*1.0)/30;
        System.out.println("微生物学的班级平均分为:"+ head2);
        double sum = 0;
        for (int i = 0; i <miaomiao3.length; i++) {
            sum+=miaomiao3[i];
        }
        head3 = (sum*1.0)/30;
        System.out.println("人体组织解剖学的班级平均分为:"+  head3);


////
        double c1 = 0,c2 = 0,c3 = 0;
        for (int i = 0; i < miaomiao1.length; i++) {
            c1+= (miaomiao1[i] -head1)*(miaomiao1[i] - head1);
        }
        meiyou1 = Math.sqrt(c1*1.0/30);
        System.out.println("生物化学的班级标准差为:"+meiyou1);

        for (int i = 0; i <miaomiao2.length; i++) {
            c2+= (miaomiao2[i] - head2)*(miaomiao2[i] -  head2);
        }
        meiyou2 = Math.sqrt(c2*1.0/30);
        System.out.println("微生物学的班级标准差为:"+meiyou2);

        for (int i = 0; i < miaomiao3.length; i++) {
            c3+= (miaomiao3[i] - head3)*(miaomiao3[i] - head3);
        }
        meiyou3 = Math.sqrt(c3*1.0/30);
        System.out.println("人体组织解剖学的班级标准差为:"+meiyou3);
//////////
//////////
        Arrays.sort(miaomiao1);
        Arrays.sort(miaomiao2);
        Arrays.sort(miaomiao3);
        langya1 =(miaomiao1[14]+miaomiao1[15])*1.0/2;
        langya2 =(miaomiao2[14]+miaomiao2[15])*1.0/2;
        langya3 =(miaomiao3[14]+miaomiao3[15])*1.0/2;
        System.out.println("生物化学的中位数为:"+langya1);
        System.out.println("微生物学的中位数为:"+langya2);
        System.out.println("人体组织解剖学的中位数为:"+langya3);





    }
}
